// Domien Nowicki
#include "QtRobotMoveAnimation.h"

QtRobotMoveAnimation::QtRobotMoveAnimation(): robot(0)
{
}

QtRobotMoveAnimation::QtRobotMoveAnimation(const QtRobotMoveAnimation& rhs): QtAnimationCommand(rhs), robot(rhs.robot), moveDirection(rhs.moveDirection)
{
}

QtRobotMoveAnimation::~QtRobotMoveAnimation()
{
}

void QtRobotMoveAnimation::SetRobot(QtRobotSprite* receiver, const Direction& direction)
{
	robot = receiver;
	moveDirection = direction;
}

void QtRobotMoveAnimation::Execute()
{
	if (robot)
	{
		switch(moveDirection.Type())
		{
			case Direction::NORTH:
				robot->MoveUp();
			break;
			case Direction::WEST:
				robot->MoveLeft();
			break;
			case Direction::SOUTH:
				robot->MoveDown();
			break;
			case Direction::EAST:
				robot->MoveRight();
			break;
		}
	}
}

QtAnimationCommand* QtRobotMoveAnimation::Clone() const
{
	return new QtRobotMoveAnimation(*this);
}
